import { createWebHashHistory, createWebHistory, createRouter } from 'vue-router'

// 路由守卫
import guarder from './guarder.js'

// 页面布局
import layout from '../extension/layout.vue'

// 公共路由
export const constantRoutes = [
	{
		path: '/',
		redirect: '/aPicture/index'
	},
	{
		path: '/aPicture',
		component: layout,
		meta: {
			title: '一张图'
		},
		children: [
			{
				component: () => import('../views/aPicture/ceshi.vue'),
				name: 'index',
				path: 'index',
				meta: {
					title: '一张图'
				}
			},
			{
				component: () => import('../views/aPicture/ceshi2.vue'),
				name: 'index2',
				path: 'index2',
				meta: {
					title: '一张图'
				}
			}
		]
	},
	{
		path: '/comprehensiveScheduling',
		component: layout,
		title: '综合调度',
		children: []
	},
	{
		path: '/productionControl',
		component: layout,
		title: '生产集控',
		children: []
	},
	{
		path: '/safeProduction',
		component: layout,
		title: '安全生产',
		children: []
	},
	{
		path: '/deviceManage',
		component: layout,
		title: '设备管理',
		children: []
	},
	{
		path: '/intelligentPark',
		component: layout,
		title: '智能园区',
		children: []
	},
	{
		path: '/login',
		name: '/login',
		component: () => import('../extension/login/login.vue'),
		meta: {
			title: '登陆页面',
			hideTabs: true
		}
	},
	{
		path: '/404',
		name: '/404',
		component: () => import('../extension/my-404.vue'),
		meta: {
			title: '404页面'
		}
	},
	{
		path: '/:pathMatch(.*)',
		name: '/:pathMatch(.*)',
		redirect: '/404'
	}
]

const router = createRouter({ history: createWebHashHistory(), routes: constantRoutes })

guarder(router)

export default router
